#include <vtkSmartPointer.h>
#include <vtkAxesActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkProperty.h>
#include <vtkAutoInit.h>
#include <vtkCaptionActor2D.h>

VTK_MODULE_INIT(vtkInteractionStyle)
VTK_MODULE_INIT(vtkRenderingOpenGL2)


int main(){
    vtkSmartPointer<vtkAxesActor> axes = vtkSmartPointer<vtkAxesActor>::New();

    axes->SetTotalLength(1.0, 1.0, 1.0);
    axes->SetShaftTypeToCylinder();
    axes->SetCylinderRadius(0.05);
    axes->SetConeRadius(0.1);
    axes->SetTipTypeToCone();

    //修改坐标轴的颜色
    axes->GetXAxisShaftProperty()->SetColor(1,0,0);
    axes->GetYAxisShaftProperty()->SetColor(0,1,0);
    axes->GetZAxisShaftProperty()->SetColor(0,0,1);

    // axes->GetXAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();
    // axes->GetYAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();
    // axes->GetZAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();

    vtkSmartPointer <vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
    renderer->AddActor(axes);
    renderer->SetBackground(0.5,0.5,0.5);

    vtkSmartPointer <vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
    renderWindow->AddRenderer(renderer);

    vtkSmartPointer <vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderWindowInteractor->SetRenderWindow(renderWindow);

    vtkSmartPointer <vtkInteractorStyleTrackballCamera> style = vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
    renderWindowInteractor->SetInteractorStyle(style);

    renderWindow->Render();
    renderWindowInteractor->Start();
    return EXIT_SUCCESS;
}